impl Solution {
    pub fn closest_divisors(num: i32) -> Vec<i32> {
        let v1 = Solution::f(num + 1);
        let v2 = Solution::f(num + 2);
        if (v1[0] - v1[1]).abs() < (v2[0] - v2[1]).abs() {
            return v1;
        }
        v2
    }
    fn f(mut num: i32) -> Vec<i32> {
        let mut i = 2;
        let mut facs = vec![];
        while i <= num {
            if num % i == 0 {
                facs.push(i);
                num /= i;
            } else {
                i += 1;
                 if i*i>num{
                    break;
                }
            }
        }
        if num != 1 {
            facs.push(num);
        };
        let mut min_abs = 1 << 31 - 1;
        let mut ans = vec![0, 0];
        let max_bit=1_i64<<(facs.len()-1);
        let mut ind=0_i64;
        let fac=&facs[..facs.len()-1];
        while ind<max_bit{
            let mut a=facs[facs.len()-1];
            let mut b=1;
            for (i,v) in fac.iter().enumerate(){
                if (1<<i)&ind!=0{
                    a*=v;
                }else{
                    b*=v;
                }
            }
            if (a-b).abs()<min_abs{
                min_abs=(a-b).abs();
                ans[0]=a;
                ans[1]=b;
            }
            ind+=1;
        };
        ans
    }
}